//
// Created by guanyicheng on 2021/11/4.
//

#include "../../common.h"

class Solution {
public:
    bool isPerfectSquare(int num) {

        int l = 0, r = num;

        while (l <= r) {
            long mid = l + ((r - l) >> 1);
            long t = mid * mid;
            if (t == num) {
                return true;
            }
            if (t > num) {
                r = mid - 1;
            }else {
                l = mid + 1;
            }
        }
        return false;
    }
};

int main() {


    cout << Solution().isPerfectSquare(4) << endl;
}
